<template>
  <div>
    <el-dialog
      title="审核记录"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      width="800px"
      @closed="resetForm('form')"
    >
      <div>
        <div class="status">
          审批意见：
          <span class="color-success" v-show="form.approverStatus == 2"
            >同意</span
          >
          <span class="color-danger" v-show="form.approverStatus == 3"
            >不同意</span
          >
        </div>
        <div class="approver-opinion" v-html="form.approverOpinion"></div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import Bus from "@/utils/bus.js";
export default {
  data() {
    return {
      dialogVisible: false,
      addOrEdit: 1,
      checkedData: {},
      form: {
        id: "", //流程实例
        approverOpinion: "", //审批意见
        approverStatus: "", //审批状态，2-同意，3-不同意
      },
    };
  },
  mounted() {
    Bus.$on("showDialogReviewHistory", (v) => {
      this.form.id = v.id;
      this.form.approverStatus = v.approverStatus;
      this.form.approverOpinion = v.approverOpinion;
      this.dialogVisible = true;
    });
  },
  beforeDestroy() {
    Bus.$off("showDialogReviewHistory");
  },
  methods: {
    //重置表单
    resetForm(form) {
      this.form.id = "";
      this.form.approverOpinion = "";
      this.form.approverStatus = "2";
    },
  },
};
</script>
<style scoped>
.approver-opinion {
  width: 100%;
  min-height: 300px;
  padding: 0 10px;
  border: 1px solid #eee;
  margin-top: 20px;
  box-sizing: border-box;
}
</style>